package com.dkd.manage.service.Impl;

import java.util.List;
import com.dkd.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dkd.manage.mapper.InventoryTransactionMapper;
import com.dkd.manage.domain.InventoryTransaction;
import com.dkd.manage.service.IInventoryTransactionService;

/**
 * 库存变动流水记录Service业务层处理
 * 
 * @author 赵文楠
 * @date 2025-05-19
 */
@Service
public class InventoryTransactionServiceImpl implements IInventoryTransactionService 
{
    @Autowired
    private InventoryTransactionMapper inventoryTransactionMapper;

    /**
     * 查询库存变动流水记录
     * 
     * @param id 库存变动流水记录主键
     * @return 库存变动流水记录
     */
    @Override
    public InventoryTransaction selectInventoryTransactionById(Long id)
    {
        return inventoryTransactionMapper.selectInventoryTransactionById(id);
    }

    /**
     * 查询库存变动流水记录列表
     * 
     * @param inventoryTransaction 库存变动流水记录
     * @return 库存变动流水记录
     */
    @Override
    public List<InventoryTransaction> selectInventoryTransactionList(InventoryTransaction inventoryTransaction)
    {
        return inventoryTransactionMapper.selectInventoryTransactionList(inventoryTransaction);
    }

    /**
     * 新增库存变动流水记录
     * 
     * @param inventoryTransaction 库存变动流水记录
     * @return 结果
     */
    @Override
    public int insertInventoryTransaction(InventoryTransaction inventoryTransaction)
    {
        inventoryTransaction.setCreateTime(DateUtils.getNowDate());
        return inventoryTransactionMapper.insertInventoryTransaction(inventoryTransaction);
    }

    /**
     * 修改库存变动流水记录
     * 
     * @param inventoryTransaction 库存变动流水记录
     * @return 结果
     */
    @Override
    public int updateInventoryTransaction(InventoryTransaction inventoryTransaction)
    {
        inventoryTransaction.setUpdateTime(DateUtils.getNowDate());
        return inventoryTransactionMapper.updateInventoryTransaction(inventoryTransaction);
    }

    /**
     * 批量删除库存变动流水记录
     * 
     * @param ids 需要删除的库存变动流水记录主键
     * @return 结果
     */
    @Override
    public int deleteInventoryTransactionByIds(Long[] ids)
    {
        return inventoryTransactionMapper.deleteInventoryTransactionByIds(ids);
    }

    /**
     * 删除库存变动流水记录信息
     * 
     * @param id 库存变动流水记录主键
     * @return 结果
     */
    @Override
    public int deleteInventoryTransactionById(Long id)
    {
        return inventoryTransactionMapper.deleteInventoryTransactionById(id);
    }
}
